import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

class WtdParser extends DataInputStream{

	int compteur=60;

	WtdParser(String fileName) throws FileNotFoundException{
		super(new FileInputStream(fileName));
		for(int i=0;i<24;i++) {
			try {
				this.readByte();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

	void goNextGame() throws EOFException {
		for(int i=0;i<8+compteur;i++) {
			try {
				this.readByte();
			} catch (EOFException e) {
				throw e;
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		compteur=60;
	}

	String next() throws EOFException {
		if(compteur==0) {
			try {
				this.goNextGame();
			} catch (EOFException e) {
				throw e;
			}
		}
		int coups=0;
		try {
			coups=this.readByte();
		} catch (EOFException e) {
			throw e;
		} catch (IOException e) {
			e.printStackTrace();
		}
		compteur--;
		return Board.decodePosition(coups);
	}

	public String toString(){
		String s=null;
		return s;
	}
}         



